$(function () {
    var token = $("#token").val();
    if (isempty(token)) {
        location.href = '/except/login.jsp';
        return;
    }
    var jsonstr = "{token:" + token + "}";
    var url = "/except/bankcontroller/getbandingbanklist.action";
    $.ajax({
        url: url,
        type: 'post',
        dataType: "json",
        data: {
            json: jsonstr
        },
        async: false,
        success: function (data) {
            var code = data.code;
            var message = data.message
            if (code == 20000) {
                var forword_type = $("#forword_type").val();
                var banknum = data.data[0].banknum;
                $("#bankinfo").append('<span onclick="forword_jsp(\'' + data.data[0].binding_num + '\',\'' + data.data[0].bankname + '\',\'' + banknum.substr(banknum.length - 4, banknum.length) + '\');"><img src="img/bags.png"/>' +
                    '<ul>' +
                    '<li>' +
                    '<span class="one">' + data.data[0].bankname + '</span>' +
                    '</li>' +
                    '<li class="lis">' +
                    '<span class="number">' + banknum.replace(banknum.substr(0, banknum.length - 4), "*********") + '</span>' +
                    '</li>' +
                    '</ul></span>' +
                    '<span class="edits" onclick="location.href=\'/except/files/user/binding_bank_info.jsp?forword_type=' + forword_type + '&bandingnum=' + data.data[0].binding_num + '\'">编辑</span>').show();
                $("#nobankinfo").hide();
                remove_advertising();
            } else if (code == 20013) {
                $("#nobankinfo").show();
                $("#bankinfo").hide();
            } else if (code == 10001 || code == 10002)
                location.href = '/except/login.jsp';
            else {
                $("#hintbg").show();
                $("#hint_message").html(message);
                savebtn = false;
            }
        }
    });
});

function forword_jsp(binding_num,bankname, banknum) {
    var forword_type = $("#forword_type").val();
    if (forword_type == 1)
        location.href = "/except/files/user/withdraw_apply.jsp?bankname=" + bankname + "&banknum=" + banknum + "&binding_num=" + binding_num;
}